<template>
  <div class="home">
    <Swipe :itemList="imgList"></Swipe>
    <Nine></Nine>
  </div>
</template>

<script>
import Swipe from '../components/Swipe.vue'
import Nine from '../components/Nine.vue'
export default {
  name: 'Home',
  data () {
    return {
      imgList: null
    }
  },
  created () {
    this.getimgList()
  },
  components: { Swipe, Nine },
  methods: {
    getimgList () {
      this.$indicator.open({ text: '加载中...' })
      // window.setTimeout((
      //   this.$indicator.close()
      // ), 2000)
      this.$http.get('imglist').then((result) => {
        this.$indicator.close()
        if (result.data.code === 1) {
          this.imgList = result.data.data
          console.log(result.data)
        } else if (result.data.code === 0) {
          this.$toast('加载轮播图失败')
        }
      })
    }
  }
}
</script>
